package com.gientech.spring.mq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.integration.support.MessageBuilder;

@EnableBinding(MessageSource.class)
public class MessageProducer {

    @Autowired
    private MessageSource messageSource;

    public void sendMessage(String msg) {
        try {
            messageSource.output().send(MessageBuilder.withPayload(msg).build());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
